<?php
    if(isset($_GET['eid']))
	{
		$id = $_GET['eid'];
		if($id != "")
			$row = mysql_fetch_array(mysql_query(" SELECT name,degree,subject FROM teachers WHERE id = {$id} "));
	}
?>

<form method="post" class="frm" id="frm_edit" name="frm_edit" style="margin: 100px 0px 0px 150px;">
    <h1> Cập nhật thông tin giáo viên </h1>
    <p class="message">  </p>
    <p> Họ tên <span style="margin-right:58px;">*</span>
        <input type="text" name="hoten" id="hoten" class="required" value="<?php echo $row['name']; ?>" /> </p>
    <p> Học vị <span style="margin-right:60px;">*</span>
        <input type="text" name="hocvi" id="hocvi" class="required" value="<?php echo $row['degree']; ?>" /> </p>
    <p> Môn giảng dạy <span style="margin-right:10px;">*</span>
        <select name="mon" id="mon" class="required">
            <?php
				$query = mysql_query(" SELECT id,name FROM subject WHERE name != '' ");
				if(mysql_num_rows($query) > 0)
				{
					while($res = mysql_fetch_array($query))
					{
						$select = $row['subject'] == $res['name'] ? "selected='selected'" : "";
						echo "<option value='".$res['name']."' $select> ".$res['name']." </option>";
					}
				}
			?>
        </select> </p>
     
     <input type="text" name="id" id="id" value="<?php echo $id; ?>" hidden="true"  />
       
    <p style="text-align:center; margin:40px 0px 20px 0px;"> 
    	<span id="loading"> </span><input type="submit" value="Cập nhật" id="submit" class="button" />
        <input type="submit" value="Hủy bỏ" id="cancel" class="button" />
        
    </p>
    
    <div id="result"> </div>
</form>
